package com.design;

import java.util.ArrayList;
import java.util.List;

/**
 * 菜单
 */
public class Menu extends MenuAbstract {

    private List<MenuAbstract> menu=new ArrayList<>();

    private String name;

    public Menu(String name){
        this.name = name;
    }

    @Override
    public void add(MenuAbstract menuAbstract) {
        menu.add(menuAbstract);
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void print() {
        System.out.println(getName());
        menu.forEach(data->data.print());
    }
}
